package com.buptlogistics.creditinvestigation.fragment;


import android.app.Fragment;
import android.content.Intent;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.Button;

import com.buptlogistics.creditinvestigation.R;
import com.buptlogistics.creditinvestigation.activity.CommonActivity;
import com.buptlogistics.creditinvestigation.app.BaseFragment;


/**
 * A simple {@link Fragment} subclass.
 */
public class LoanFragment extends BaseFragment {
    private View view;
    private Button mbtn_order, mbtn_remain, mbtn_advance, mbtn_else;

    public LoanFragment() {
        // Required empty public constructor
    }


    @Override
    public View onCreateView(LayoutInflater inflater, ViewGroup container,
                             Bundle savedInstanceState) {
        // Inflate the layout for this fragment
        view = inflater.inflate(R.layout.fragment_loan, container, false);
        initViews();
        initEvents();
        return view;
    }

    protected void initViews() {
        mbtn_order = (Button) findViewById(R.id.btn_loan_order);
        mbtn_remain = (Button) findViewById(R.id.btn_loan_remain);
        mbtn_advance = (Button) findViewById(R.id.btn_loan_advance);
        mbtn_else = (Button) findViewById(R.id.btn_loan_else);

    }

    protected void initEvents() {
        mbtn_advance.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                Bundle data = new Bundle();
                data.putInt("fragmentType", 2);
                // 创建一个Intent
                Intent intent = new Intent(LoanFragment.this.getActivity(),
                        CommonActivity.class);
                intent.putExtras(data);
                // 启动intent对应的Activity
                startActivity(intent);

            }
        });
    }

    protected View findViewById(int id) {
        return view.findViewById(id);
    }
}
